      SUBROUTINE SETUP
      RETURN
      END
C   HS107
      SUBROUTINE EF(X,FX)
      INCLUDE 'FUCO.INC'
      DOUBLE PRECISION X(NX),FX
      ICF=ICF+1
      FX=(1.D0*X(1)*(X(1)**2+3.D0)+2.D0*X(2)*(1.D0+X(2)**2/3.D0))*1.D3
      RETURN
      END
      SUBROUTINE EGRADF(X,GRADF)
      INCLUDE 'FUCO.INC'
      INTEGER I
      DOUBLE PRECISION X(NX),GRADF(NX)
      ICGF=ICGF+1
      DO      100      I=3,9
      GRADF(I)= 0. D0
 100  CONTINUE
      GRADF(1)=3.D3*(1.D0+X(1)**2)
      GRADF(2)= 2. D3*(1.D0 +X(2)**2)
      RETURN
      END
      SUBROUTINE EH(I,X,HXI)
      INCLUDE 'FUCO.INC'
      DOUBLE PRECISION X(NX),HXI,C,D,Y1,Y2,Y3,Y4,Y5,Y6
      INTEGER I
      CRES(I)=CRES(I)+1
      C=48.4D0/50.176D0*DSIN(.25D0)
      D=48.4D0/50.176D0*DCOS(.25D0)
      GOTO (100,200,300,400,500,600),I
  100 CONTINUE
      Y1=DSIN(X(8))
      Y2=DCOS(X(8))
      Y3=DSIN(X(9))
      Y4=DCOS(X(9))
      HXI=.4D0-X(1)+X(5)*((C+C)*X(5)-X(6)*(D*Y1+C*Y2)-X(7)*(D*Y3
     1    +C*Y4))
      RETURN
  200 CONTINUE
      Y1=DSIN(X(8))
      Y2=DCOS(X(8))
      Y5=DSIN(X(8)-X(9))
      Y6=DCOS(X(8)-X(9))
      HXI=.4D0-X(2)+X(6)*((C+C)*X(6)+X(5)*(D*Y1-C*Y2)+X(7)*(D*Y5-
     1    C*Y6))
      RETURN
  300 CONTINUE
      Y3=DSIN(X(9))
      Y4=DCOS(X(9))
      Y5=DSIN(X(8)-X(9))
      Y6=DCOS(X(8)-X(9))
      HXI=.8D0+X(7)*((C+C)*X(7)+X(5)*(D*Y3-C*Y4)-X(6)*(D*Y5+C*Y6))
      RETURN
  400 CONTINUE
      Y1=DSIN(X(8))
      Y2=DCOS(X(8))
      Y3=DSIN(X(9))
      Y4=DCOS(X(9))
      HXI=.2D0-X(3)+X(5)*((D+D)*X(5)+X(6)*(C*Y1-D*Y2)+X(7)*(C*Y3-D*Y4))
      RETURN
  500 CONTINUE
      Y1=DSIN(X(8))
      Y2=DCOS(X(8))
      Y5=DSIN(X(8)-X(9))
      Y6=DCOS(X(8)-X(9))
      HXI=.2D0-X(4)+X(6)*((D+D)*X(6)-X(5)*(C*Y1+D*Y2)-X(7)*
     1    (C*Y5+D*Y6))
      RETURN
  600 CONTINUE
      Y3=DSIN(X(9))
      Y4=DCOS(X(9))
      Y5=DSIN(X(8)-X(9))
      Y6=DCOS(X(8)-X(9))
      HXI=-.337D0+X(7)*((D+D)*X(7)-X(5)*(C*Y3+D*Y4)+X(6)*
     1    (C*Y5-D*Y6))
      RETURN
      END
      SUBROUTINE EGRADH(I,X,GRADHI)
      INCLUDE 'FUCO.INC'
      INTEGER I,J
      DOUBLE PRECISION X(NX),GRADHI(NX),C,D,Y1,Y2,Y3,Y4,Y5,Y6
      CGRES(I)=CGRES(I)+1
      C=48.4D0/50.176D0*DSIN(.25D0)
      D=48.4D0/50.176D0*DCOS(.25D0)
      Y1=DSIN(X(8))
      Y2=DCOS(X(8))
      Y3=DSIN(X(9))
      Y4=DCOS(X(9))
      Y5=DSIN(X(8)-X(9))
      Y6=DCOS(X(8)-X(9))
      DO      50      J=1,4
      GRADHI(J)=0.D0
  50  CONTINUE
      GOTO (100,200,300,400,500,600),I
  100 CONTINUE
      GRADHI(1)=-1.D0
      GRADHI(5)=4.D0*C*X(5)- X(6)*(D*Y1+C*Y2)-X(7)*(D*Y3+C*Y4)
      GRADHI(6)=-X(5)*(D*Y1+C*Y2)
      GRADHI(7)=-X(5)*(D*Y3+C*Y4)
      GRADHI(8)=-X(5)*X(6)*(D*Y2-C*Y1)
      GRADHI(9)=-X(5)* X(7)*(D*Y4-C*Y3)
      RETURN
  200 CONTINUE
      GRADHI(2)=-1.D0
      GRADHI(5)=X(6)*(D*Y1-C*Y2)
      GRADHI(6)=4.D0*C*X(6)+X(5)*(D*Y1-C*Y2)+X(7)*(D*Y5-C*Y6)
      GRADHI(7)=X(6)*(D*Y5-C*Y6)
      GRADHI(8)=X(5)*X(6)*(D*Y2+C*Y1)+X(6)*X(7)*(D*Y6+C*Y5)
      GRADHI(9)=X(7)* X(6)*(-D*Y6-C*Y5)
      RETURN
  300 CONTINUE
      GRADHI(5)=X(7)*(D*Y3-C*Y4)
      GRADHI(6)=-X(7)*(D*Y5+C*Y6)
      GRADHI(7)=X(5)*(D*Y3-C*Y4)-X(6)*(D*Y5+C*Y6)+4.D0*C*X(7)
      GRADHI(8)=-X(7)* X(6)*(D*Y6-C*Y5)
      GRADHI(9)= X(5)*X(7)*(D*Y4+C*Y3)-X(6)*X(7)*(-D*Y6+C*Y5)
      RETURN
  400 CONTINUE
      GRADHI(3)=-1.D0
      GRADHI(5)=4.D0*D*X(5)+ X(6)*(C*Y1-D*Y2)+X(7)*(C*Y3-D*Y4)
      GRADHI(6)= X(5)*(C*Y1-D*Y2)
      GRADHI(7)= X(5)*(C*Y3-D*Y4)
      GRADHI(8)= X(5)*X(6)*(C*Y2+D*Y1)
      GRADHI(9)= X(5)* X(7)*(C*Y4+D*Y3)
      RETURN
  500 CONTINUE
      GRADHI(4)=-1.D0
      GRADHI(5)=-X(6)*(C*Y1+D*Y2)
      GRADHI(6)=4.D0*D*X(6)-X(5)*(C*Y1+D*Y2)-X(7)*(C*Y5+D*Y6)
      GRADHI(7)=-X(6)*(C*Y5+D*Y6)
      GRADHI(8)=-X(6)*(X(5)*(C*Y2-D*Y1)+X(7)*(C*Y6-D*Y5))
      GRADHI(9)=X(7)* X(6)*( C*Y6-D*Y5)
      RETURN
  600 CONTINUE
      GRADHI(5)=-X(7)*(C*Y3+D*Y4)
      GRADHI(6)= X(7)*(C*Y5-D*Y6)
      GRADHI(7)=4.D0*D*X(7)-X(5)*(C*Y3+D*Y4)+X(6)*(C*Y5-D*Y6)
      GRADHI(8)= X(6)* X(7)*(C*Y6+D*Y5)
      GRADHI(9)=-X(5)*X(7)*(C*Y4-D*Y3)+X(6)*X(7)*(-C*Y6-D*Y5)
      RETURN
      END
      SUBROUTINE EG(I,X,GXI)
      INCLUDE 'FUCO.INC'
      DOUBLE PRECISION X(NX),GXI
      INTEGER I
      IF(I .GT.  2)      GOTO 100
      GXI=X(I)
      RETURN
 100  CONTINUE
      IF(I .LE. 5)      GXI=X(I+2)-.909090D0
      IF(I .GT. 5)      GXI=1.0909D0-X(I-1)
      RETURN
      END
      SUBROUTINE EGRADG(I,X,GRADGI)
      INCLUDE 'FUCO.INC'
      INTEGER I
      DOUBLE PRECISION X(NX) ,GRADGI(NX)
      IF ( GUNIT(1,I+NH) .EQ. 1 ) RETURN 
      CGRES(I+NH)=CGRES(I+NH)+1
      RETURN
      END
      BLOCK DATA
      INCLUDE 'BLOCO.INC'
      INTEGER I,J
      DATA NAME/'HS107'/
      DATA (X(I),I=1,9)/2*.8D0,2*.2D0,3*1.0454D0,2*0.D0/
      DATA N/9/ , NH/6/ , NG/ 8/
      DATA DEL0/9.0905D-2/ ,TAU0/1.D0/ ,TAU/.1D0/
      DATA (GUNIT(1,J),J=0,6)/7*-1/,((GUNIT(I,J),I=2,3),J=0,6)/14*0/,
     F     (GUNIT(1,J),J=7,14)/8*1/,(GUNIT(2,J),J=7,14)/1,2,5,6,7,
     F     5,6,7/,(GUNIT(3,J),J=7,14)/5*1,3*-1/     
      END

